[core]
@memory color: float
@memory alpha0: float
@memory alpha1: float
@memory alpha2: float
@memory alpha3: float
@memory alpha4: float
@memory alpha5: float
@memory alpha6: float
@memory alpha7: float

name: OUROBOROS
mass: 1
radius: 12
price: 0
maxHp: 1

autoTriggerCooldownTime: 5
tags: ouroboros
#   #   #   #   #   #   #   # 
transportUnitsRequireTag: ouroboros
transportUnitsKeepBuiltUnits: true
transportUnitsKillOnDeath: true
transportUnitsBlockOtherTransports: false
#   #   #   #   #   #   #   # 

[graphics]
image: ROOT:drawable\null.png
movementEffect: NONE
movementEffectRate: 4


#   #   #   #   #   #   #   #   
#   #   #   #   #   #   #   #   
#   #   #   #   #   #   #   #  


[hiddenAction_initial]
autoTriggerOnEvent: created
setUnitMemory: """
color=0,
alpha0 = 1,
alpha1 = 0,
alpha2 = 0,
alpha3 = 0,
alpha4 = 0,
alpha5 = 0,
alpha6 = 0,
alpha7 = 0
"""

#   #   #   #   #   #   #   #  
[template_colorShift]
autoTrigger: if memory.color == ${color}
setUnitMemory: """
alpha${color + 1} = memory.alpha${color + 1} + 0.1,
alpha${color} = memory.alpha${color} - 0.1
"""
#   #   #   #   #   #   #   #  

[hiddenAction_color_0]
@define color: 0
@copyFromSection: template_colorShift

[hiddenAction_color_1]
autoTrigger: if memory.color == 1
setUnitMemory: """
alpha2 = memory.alpha2 + 0.1,
alpha1 = memory.alpha1 - 0.1
"""
[hiddenAction_color_2]
@define color: 2
@copyFromSection: template_colorShift
[hiddenAction_color_3]
@define color: 3
@copyFromSection: template_colorShift
[hiddenAction_color_4]
@define color: 4
@copyFromSection: template_colorShift
[hiddenAction_color_5]
@define color: 5
@copyFromSection: template_colorShift
[hiddenAction_color_6]
@define color: 6
@copyFromSection: template_colorShift
[hiddenAction_color_7]
autoTrigger: if memory.color == 7
setUnitMemory: """
alpha1 = memory.alpha1 + 0.1,
alpha7 = memory.alpha7 - 0.1
"""
#   #   #   #   #   #   #   #  
[template_colorSet]
autoTrigger: if memory.alpha${color + 1} > 1
setUnitMemory: """
color = ${color + 1},
alpha${color} = 0
"""
#   #   #   #   #   #   #   #  
[hiddenAction_colorSet_0]
@define color: 0
@copyFromSection: template_colorSet

[hiddenAction_colorSet_1]
autoTrigger: if memory.alpha2 > 1
setUnitMemory: """
color = 2,
alpha1 = 0
"""
[hiddenAction_colorSet_2]
@define color: 2
@copyFromSection: template_colorSet
[hiddenAction_colorSet_3]
@define color: 3
@copyFromSection: template_colorSet
[hiddenAction_colorSet_4]
@define color: 4
@copyFromSection: template_colorSet
[hiddenAction_colorSet_5]
@define color: 5
@copyFromSection: template_colorSet
[hiddenAction_colorSet_6]
@define color: 6
@copyFromSection: template_colorSet
[hiddenAction_colorSet_7]
autoTrigger: if memory.alpha1 > 1
setUnitMemory: """
color = 1,
alpha7 = 0
"""
#   #   #   #   #   #   #   #   
#   #   #   #   #   #   #   #   
#   #   #   #   #   #   #   #   
[template_base]
image: base.png
alpha: memory.alpha${color}
#   #   #   #   #   #   #   #   
[decal_white]
color: #FFFFFF
@define color: 0
@copyFromSection: template_base
#   #   #   #   #   #   #   #   
[decal_red]
color: #FF0000
@define color: 1
@copyFromSection: template_base
[decal_orange]
color: #FF8000
@define color: 2
@copyFromSection: template_base
[decal_yellow]
color: #FFFF00
@define color: 3
@copyFromSection: template_base
[decal_green]
color: #00FF00
@define color: 4
@copyFromSection: template_base
[decal_cyan]
color: #00FFFF
@define color: 5
@copyFromSection: template_base
[decal_blue]
color: #0000FF
@define color: 6
@copyFromSection: template_base
[decal_purple]
color: #FF00FF
@define color: 7
@copyFromSection: template_base
#   #   #   #   #   #   #   #   
#   #   #   #   #   #   #   #   
#   #   #   #   #   #   #   #   





[hiddenAction_created]
autoTriggerOnEvent:created
addResources: food=1
alsoQueueAction: growAction

[hiddenAction_kill]
autoTriggerOnEvent:killedAnyUnit
addResources: food=1, hp=400

[resource_food]
displayName: food

[hiddenAction_return]
autoTrigger: if self.resource(type='food', greaterThan=200)
#takeResources_includeUnitsInTransport: true
alsoTriggerAction: growAction

#[hiddenAction_resources]
#autoTrigger: if self.resource(type='food', greaterThan=0)
#alsoTriggerAction: growAction

[hiddenAction_growAction]
requireConditional: if self.numberOfAttachedUnits(withTag='ouroboros', lessThan=1)
#autoTrigger: if self.customTimer(laterThanSeconds=1)
#autoTrigger: if self.resource(type='food', greaterThan=0)
produceUnits: OUROBOROS
#resetCustomTimer: true
addResources: food=-1

[hiddenAction_grow]
produceUnits: OUROBOROS
buildSpeed: 1s

[attachment_body]
x: 0
y: -12
idleDir: 0
isVisible: true
setDrawLayerOnBottom: true
canBeAttackedAndDamaged: true
isUnselectable: false
keepAliveWhenParentDies: false
addTransportedUnits: true
lockRotation: false
rotateWithParent: false
deattachIfWantingToMove: false
canAttack: false
resetRotationWhenNotAttacking:true